
import './App.scss';
import React, { Component, lazy, Suspense } from 'react';
import { Route, Redirect, Switch } from 'react-router-dom';
import img from '../src/assets/ld.gif'
// 懒加载
var Index = lazy(() => import('./views/Index'))
var Login = lazy(() => import('./views/Login'))
var Register = lazy(() => import('./views/Register'))
var Detail = lazy(() => import('./views/Detail'))
var City = lazy(() => import('./views/City'))
var Setting = lazy(() => import('./views/Setting'))
var User = lazy(() => import('./views/User'))
var Password = lazy(() => import('./views/Password'))
var Seach = lazy(() => import('./views/Seach'))
var Hotseach = lazy(() => import('./views/Hotseach'))
var Address = lazy(() => import('./views/Address'))
var Newadd = lazy(() => import('./views/Newadd'))
var Edit = lazy(() => import('./views/Edit'))
var Order = lazy(() => import('./views/Order'))
var Result = lazy(() => import('./views/Result'))
var Ding = lazy(() => import('./views/Ding'))
var Fu = lazy(() => import('./views/Fu'))
var Fahuo = lazy(() => import('./views/Fahuo'))
var Ping = lazy(() => import('./views/Ping'))
var NotFound = lazy(() => import('./views/NotFound'))
class App extends Component {
  render() {
    return (

      <div className="App">
        <Suspense fallback={<div className='loading'><img src={img} alt="" /></div>}>
          <Switch>
            < Route path="/index" component={Index} />
            < Route exact path="/login" component={Login} />
            < Route path="/Register" component={Register} />
            < Route exact path="/detail/:proid" component={Detail} />
            <Route exact path="/City" component={City} />
            <Route exact path="/setting" component={Setting} />
            <Route exact path="/user" component={User} />
            <Route exact path="/password" component={Password} />
            <Route exact path="/Address" component={Address} />
            <Route exact path="/Newadd" component={Newadd} />
            <Route exact path="/Seach" component={Seach} />
            <Route exact path="/Edit" component={Edit} />
            <Route exact path="/Order" component={Order} />
            <Route exact path="/Result" component={Result} />
            <Route exact path="/ding" component={Ding} />
            <Route exact path="/fu" component={Fu} />
            <Route exact path="/fahuo" component={Fahuo} />
            <Route exact path="/ping" component={Ping} />
            <Route exact path="/Hotseach" component={Hotseach} />
            < Redirect exact from="/" to="/index" />
            < Route exact path="*" component={NotFound} />
          </Switch>
        </Suspense>
      </div>
    )
  };
}

export default App;
